<template>
  <div>
    <div class="layout-content control-content">
      <!-- 查询表单 -->
      <Form
        ref="formInline"
        :model="searchfrom"
        inline
        class="from-content"
        @submit.native.prevent="search"
      >
        <FormItem label="姓名" :label-width="60">
          <Input type="text" v-model="searchfrom.HZXM" placeholder="请输入查找的患者姓名" />
        </FormItem>
        <FormItem label="是否出院" :label-width="60">
          <Select v-model="searchfrom.SFCY">
            <Option value="全部">全部</Option>
            <Option value="是">是</Option>
            <Option value="否">否</Option>
          </Select>
        </FormItem>
        <FormItem>
          <Button type="primary" @click="search">查询</Button>
        </FormItem>
      </Form>
    </div>
    <div class="layout-content main-content">
      <div class="table-title-warp">
        <div class="table-title">
          <Icon type="ios-people" :size="20" />患者列表
        </div>
        <div class="table-title-right">
          <Button type="primary" class="add-button" size="small" @click="add()">
            <Icon type="md-add" />新增患者
          </Button>
        </div>
      </div>

      <Table
        ref="table"
        border
        :columns="fields"
        :data="tabledata"
        :height="tableHeight"
        :loading="tableLoading"
      >
        <!-- table 操作 -->
        <template slot-scope="{ row }" slot="action">
          <Button class="action-button" type="error" size="small" @click="edit(row.Id)">编辑</Button>
          <Button class="action-button" type="primary" size="small" @click="set_turn(row.Id)">排班</Button>
          <Button class="action-button" type="info" size="small" @click="remove(row.Id)">打印排班</Button>
          <Button class="action-button" type="warning" size="small" @click="remove(row.Id)">周转</Button>
          <Button class="action-button" type="success" size="small" @click="remove(row.Id)">发送消息</Button>
        </template>
      </Table>
      <!-- 分页区域 -->
      <div class="page-cut">
        <Page @on-change="pageChange" :total="total" :page-size="11" size="small" show-elevator />
      </div>
    </div>

    <!-- --------------------------------------------------患者新增编辑弹窗-------------------------------------------------------->
    <Modal
      class="suffer_form"
      v-model="modal_visable"
      :title="modal_title"
      :loading="modalLoading"
      width="1200"
      :styles="{top: '3px'}"
      @on-visible-change="reset_modal_form()"
      :mask-closable="false"
    >
      <!-- 弹层内容 -->

      <Form ref="suffers_form" :model="suffers_form" :rules="suffer_form_rules">
        <div>
          <Card :padding="0" dis-hover style="margin-top:0;">
            <p slot="title">患者信息</p>
            <input hidden v-model="suffers_form.id" />
            <table cellspacing="0" class="info-table" width="100%">
              <tr>
                <td class="title notnull">姓名：</td>
                <td>
                  <FormItem prop="Nickname">
                    <Input type="text" v-model="suffers_form.Nickname" placeholder="请输入患者姓名" />
                  </FormItem>
                </td>
                <td class="title">性别：</td>
                <td>
                  <FormItem prop="Sex">
                    <Select v-model="suffers_form.Sex">
                      <Option value="男">男</Option>
                      <Option value="女">女</Option>
                    </Select>
                  </FormItem>
                </td>
                <td class="title">年龄：</td>
                <td>
                  <FormItem prop="Age">
                    <Input type="text" v-model="suffers_form.Age" placeholder="请输入年龄" />
                  </FormItem>
                </td>
                <td class="title">患者类型：</td>
                <td>
                  <FormItem prop="Type">
                    <Select v-model="suffers_form.Type">
                      <Option value="住院">住院</Option>
                      <Option value="门诊">门诊</Option>
                    </Select>
                  </FormItem>
                </td>
                <td class="title notnull">住院号：</td>
                <td>
                  <FormItem prop="Checkin">
                    <Input type="text" v-model="suffers_form.Checkin" placeholder="请输入住院号" />
                  </FormItem>
                </td>
              </tr>
              <tr>
                <td class="title">床号：</td>
                <td>
                  <FormItem prop="Bed">
                    <Input type="text" v-model="suffers_form.Bed" placeholder="请输入床号" />
                  </FormItem>
                </td>
                <td class="title">发病日期：</td>
                <td>
                  <FormItem prop="Attack_time">
                    <DatePicker
                      type="date"
                      v-model="suffers_form.Attack_time"
                      format="yyyy-MM-dd"
                      show-week-numbers
                      placeholder="请选发病日期"
                      @on-change="suffers_form.Attack_time=$event"
                    ></DatePicker>
                  </FormItem>
                </td>
                <td class="title">入院日期：</td>
                <td>
                  <FormItem prop="Checkin_time">
                    <DatePicker
                      type="date"
                      v-model="suffers_form.Checkin_time"
                      format="yyyy-MM-dd"
                      show-week-numbers
                      placeholder="请选择入院日期"
                      @on-change="suffers_form.Checkin_time=$event"
                    ></DatePicker>
                  </FormItem>
                </td>
                <td class="title">床头治疗：</td>
                <td>
                  <FormItem prop="Bedh">
                    <Select v-model="suffers_form.Bedh">
                      <Option value="是">是</Option>
                      <Option value="否">否</Option>
                    </Select>
                  </FormItem>
                </td>
                <td class="title">点滴：</td>
                <td>
                  <FormItem prop="Drip">
                    <Select v-model="suffers_form.Drip">
                      <Option value="是">是</Option>
                      <Option value="否">否</Option>
                    </Select>
                  </FormItem>
                </td>
              </tr>
              <tr>
                <td class="title">传染病：</td>
                <td colspan="3">
                  <FormItem prop="Infect">
                    <Input type="text" v-model="suffers_form.Infect" placeholder="请输入传染病信息" />
                  </FormItem>
                </td>
                <td class="title">病史：</td>
                <td colspan="5">
                  <FormItem prop="History">
                    <Input type="text" v-model="suffers_form.History" placeholder="请输入病史信息" />
                  </FormItem>
                </td>
              </tr>
              <tr>
                <td class="title">医师：</td>
                <td>
                  <FormItem prop="YS">
                    <Input type="text" v-model="suffers_form.YS" readonly />
                  </FormItem>
                </td>
                <td class="title">诊断：</td>
                <td colspan="3">
                  <FormItem prop="Diagnose">
                    <Input type="text" v-model="suffers_form.Diagnose" placeholder="请输入诊断信息" />
                  </FormItem>
                </td>
                <td class="title">注意事项：</td>
                <td colspan="3">
                  <FormItem prop="Notes">
                    <Input type="text" v-model="suffers_form.Notes" placeholder="请输入注意事项" />
                  </FormItem>
                </td>
              </tr>
            </table>
          </Card>
          <Card :padding="0" dis-hover>
            <p slot="title">康复评定项目</p>
            <Row class>
              <i-col span="3">
                <div class="item-title">评定</div>
              </i-col>
              <i-col span="21" class="left-divider">
                <Form-item style="margin-bottom:0;">
                  <Checkbox-group>
                    <i-col span="4" v-for="el in PD_LIST" :key="el.ID">
                      <Checkbox v-model="el.isActive">{{el.NAME}}</Checkbox>
                    </i-col>
                  </Checkbox-group>
                </Form-item>
              </i-col>
            </Row>
          </Card>
          <Card :padding="0" dis-hover>
            <p slot="title">康复治疗项目</p>
            <template v-for="(el,index) in ZL_LIST">
              <Row class :key="el.id" v-if="el.LBXMS&&el.LBXMS.length>0">
                <i-col span="3">
                  <div class="item-title">{{el.XMLB}}</div>
                </i-col>
                <i-col span="21" class="left-divider">
                  <Form-item style="margin-bottom:0;">
                    <!-- <Checkbox-group @on-change="select_action2"> -->
                    <i-col :span="item.SFBZ?5:8" v-for="item in el.LBXMS" :key="item.id">
                      <i-col span="8">
                        <Checkbox v-model="item.isActive">{{item.XMMC}}</Checkbox>
                      </i-col>
                      <i-col span="5">
                        <Select v-model="item.PC" placeholder="频次">
                          <Option value="1x1">1x1</Option>
                          <Option value="1x2">1x2</Option>
                          <Option value="2x1">2x1</Option>
                          <Option value="2x2">2x2</Option>
                        </Select>
                      </i-col>
                      <!-- v-if="item.ZLBW" -->
                      <template>
                        <i-col span="5">
                          <Select v-model="item.BW" placeholder="部位">
                            <Option value="2">2</Option>
                            <Option value="4">4</Option>
                            <Option value="8">8</Option>
                          </Select>
                        </i-col>
                      </template>
                      <!-- v-if="item.SFBZ" -->
                      <template>
                        <i-col span="5">
                          <Input type="text" v-model="item.BZ" placeholder="备注" />
                        </i-col>
                      </template>
                    </i-col>
                    <!-- </Checkbox-group> -->
                  </Form-item>
                </i-col>
                <Divider
                  v-if="index != edit_from_items.ZL.length-1"
                  style="margin-bottom:0;margin-top:0;"
                />
              </Row>
            </template>
          </Card>
        </div>
      </Form>
      <div slot="footer">
        <Button @click="modal_cancel">取消</Button>
        <Button type="primary" @click="modal_ok">确定</Button>
      </div>
      <!-- 弹层内容 end -->
    </Modal>

    <!-- --------------------------------------------------患者新增编辑弹窗-------------------------------------------------------->

    <!-- --------------------------------------------------排班-------------------------------------------------------->

    <Modal
      v-model="modal2_visable"
      :title="modal2_title"
      :loading="false"
      width="1200"
      @on-visible-change="modal2_close()"
      :mask-closable="false"
    >
      <!-- 弹层内容 -->
      <Form ref="modal_form" :model="modal_form" :rules="modal_form_rules">
        <Row :gutter="16" style="min-height:500px;">
          <i-col span="16">
            <table style="width:100%;" class="table-turn" cellspacing="0">
              <thead>
                <tr>
                  <th colspan="4" class="title">排班时间表</th>
                  <th>
                    <Button
                      type="primary"
                      size="small"
                      shape="circle"
                      icon="md-add"
                      @click="addPb()"
                    ></Button>
                  </th>
                </tr>
                <tr>
                  <th class="title">时间</th>
                  <th class="title">项目</th>
                  <th class="title">负责人</th>
                  <th class="title">地点</th>
                  <th class="title">操作</th>
                </tr>
              </thead>
              <tbody>
                <tr v-for="(item,index) in PB_FORM" :key="index">
                  <!-- {{item.Time}} -->
                  <!-- job:{{item.Job}} -->
                  <!-- {{item.Member_id}} -->
                  <!-- {{item.Address}} -->
                  <!-- {{MY_ZLXM}} -->
                  <td>
                    <FormItem>
                      <!-- :value="value2" -->
                      <TimePicker
                        v-model="item.TIME"
                        format="HH:mm"
                        type="timerange"
                        placement="bottom-end"
                        placeholder="开始时间-结束时间"
                        style="width:100%;"
                      ></TimePicker>
                    </FormItem>
                  </td>
                  <td>
                    <FormItem>
                      <Select v-model="item.Job" @on-change="projectChange(item.Job,index,true)">
                        <Option
                          :value="itemm.project_id"
                          v-for="itemm in MY_ZLXM"
                          :key="itemm.project_id"
                        >{{itemm.project_name}}{{itemm.project_id}}</Option>
                      </Select>
                    </FormItem>
                  </td>
                  <td>
                    <FormItem>
                      <Select
                        v-model="item.Member_id"
                        @on-change="getMemberPb(item.Member_id,index)"
                      >
                        <Option
                          :value="itemm.Id"
                          v-for="itemm in item.ZLSs"
                          :key="itemm.Id"
                        >{{itemm.Nickname}}</Option>
                      </Select>
                    </FormItem>
                  </td>
                  <td>
                    <FormItem>
                      <Input type="text" v-model="item.Address" placeholder="地点" />
                    </FormItem>
                  </td>
                  <td>
                    <Button
                      type="error"
                      size="small"
                      shape="circle"
                      icon="md-remove"
                      @click="PB_FORM.splice(index,1)"
                    ></Button>
                  </td>
                </tr>
              </tbody>
            </table>
          </i-col>
          <i-col span="8">
            <table style="width:100%;" class="table-turn" cellspacing="0">
              <thead>
                <tr>
                  <th class="title" colspan="4">治疗师排班提示——某某某</th>
                </tr>
                <tr>
                  <th class="title">时间</th>
                  <th class="title">患者姓名</th>
                  <th class="title" width="200px">项目</th>
                </tr>
              </thead>
              <tbody>
                <template v-if="ZLS_ZLXM&&ZLS_ZLXM.length>0">
                  <tr v-for="item in ZLS_ZLXM" :key="item.x">
                    <td>{{item.time}}</td>
                    <td>{{item.Nickname}}</td>
                    <td>{{item.Job}}</td>
                  </tr>
                </template>
                <template v-else>
                  <tr>
                    <td colspan="3">没有数据</td>
                  </tr>
                </template>
              </tbody>
            </table>
          </i-col>
        </Row>
      </Form>
      <div slot="footer">
        <Button @click="modal2_cancel">取消</Button>
        <Button type="primary" @click="modal2_ok">确定</Button>
      </div>
    </Modal>

    <!-- --------------------------------------------------排班-------------------------------------------------------->
  </div>
</template>

<script>
import mixin from "../Mixin/mix";
import ajax from "./ajax.js";
import data from "./data.js";

export default {
  data() {
    return {
      HZ_ID: "", //当前患者的ID
      ZLS_ZLXM: [], //患者排班-当前患者的排班列表
      MY_ZLXM: [], //患者排班-我的治疗项目
      ZL_LIST: [], //治疗项目列表
      PD_LIST: [], //评定项目列表
      tableLoading: false, //列表加载动画
      page: 1, //当前页码
      // 弹层显示状态
      modal_visable: false,
      modal_title: "弹层标题",
      modalLoading: false,
      modal2_visable: false,
      modal2_title: "弹层标题",
      // 查询表单
      searchfrom: {
        HZXM: "",
        SFCY: "全部"
      },
      total: 0, //总页数
      PB_FORM: [], //当前患者排班列表
      value2: [],
      // 表格字段
      fields: data.fields,
      // 表格数据
      tabledata: [],
      //编辑列
      suffers_form: {
        Id: 0,
        Nickname: "",
        Sex: "",
        Age: "",
        Bed: "",
        Checkin: "", //住院号
        Attack_time: "", //发病日期
        Checkin_time: "", //入院日期
        Diagnose: "", //诊断信息
        Status: "",
        Notes: "", //注意事项
        History: "", //病史
        Infect: "", //传染病
        Bedh: "", //床头治疗
        Drip: "", //点滴
        Type: "" //患者类型
      },
      suffer_form_rules: data.suffer_from_rules,
      edit_row: {},
      edit_from: {},

      edit_from_items: {
        PT: {},
        ZL: {}
      },
      // 弹层表单
      modal_form: {
        value: ""
      },
      // 弹层表单校验规则
      modal_form_rules: {
        // value: [{ required: true, message: "请添加", trigger: "blur" }]
      }
    };
  },
  mixins: [mixin],
  created() {
    this.loadData();
    this.getListData();
    //设置医师姓名
    this.suffers_form.YS = window.localStorage.Nickname;
    if (this.isDev) {
      this.suffers_form = {
        Id: 0,
        Nickname: "测hi",
        Sex: "男",
        Age: "18",
        Bed: "床号",
        Checkin: "住院号", //住院号
        Attack_time: "2019-07-17", //发病日期
        Checkin_time: "2019-07-17", //入院日期
        Diagnose: "诊断", //诊断信息
        Status: "",
        Notes: "注意事项", //注意事项
        History: "病史", //病史
        Infect: "传染病", //传染病
        Bedh: "是", //床头治疗
        Drip: "是", //点滴
        Type: "住院" //患者类型
      };
    }
  },
  mounted() {},
  methods: {
    //添加一条排班记录
    addPb() {
      this.PB_FORM.push({
        Time: "", // 时间
        Job: "", // 治疗项目id
        Member_id: "", // 负责人id
        Address: "", // 地点
        ZLSs: [] //治疗师
      });
      //  this.PB_FORM.push({
      //   KSSJ: "", // 开始时间
      //   JSSJ: "", // 结束时间
      //   ZLXM: "", // 治疗项目id
      //   ZLS: "", // 负责人id
      //   DD: "", // 地点
      //   ZLSs: [] //治疗师
      // });
    },
    //获取当前治疗师的排班情况
    getMemberPb(id, index) {
      if (!id) return;
      this.ajax("/api/Patient/GetMember", "get", { id }, true).then(res => {
        let response = res.data;
        if (response.code == 200) {
          this.ZLS_ZLXM = response.data.LIST;
        }
      });
    },
    //排班-切换项目获取当前项目治疗师
    projectChange(id, index, getPb) {
      this.ajax("/api/Patient/GetMemberByProjectId", "get", { id }, true).then(
        res => {
          let response = res.data;
          if (response.code == 200) {
            this.PB_FORM[index].ZLSs = response.data;
            //设置第一个治疗师
            if (response.data && response.data.length > 0) {
              //如果当前项目有治疗师则去请求当前治疗师的排班列表
              if (getPb) {
                let itemID = response.data[0].Id;
                this.PB_FORM[index].Member_id = itemID;
                this.getMemberPb(itemID, index);
              }
            } else {
              this.PB_FORM[index].Member_id = "";
            }
          }
        }
      );
    },
    //页码更新
    pageChange(page) {
      this.page = page;
      this.loadData();
    },
    // 获取数据
    loadData() {
      let formData = {
        HZXM: this.searchfrom.HZXM,
        SFCY: this.searchfrom.SFCY,
        page: this.page,
        limit: 11
      };

      this.tableLoading = true;
      this.ajax("/api/Patient/GetPatientInfo", "get", formData, true).then(
        res => {
          this.tableLoading = false;
          let response = res.data;
          if (response.code == 200) {
            this.total = response.data.Page.count;
            this.tabledata = response.data.LIST;
          }
        }
      );
    },
    //获取两个项目列表
    getListData() {
      // PD_LIST
      this.ajax("/api/Patient/GetPdandZLInfo", "get", {}, true).then(res => {
        this.tableLoading = false;
        let response = res.data;
        if (response.code == 200) {
          let PD = response.data.PD;
          let ZL = response.data.ZL;
          if (PD && PD.length > 0) {
            PD.map(item => (item.isActive = false));
          }
          if (ZL && ZL.length > 0) {
            ZL.map(item => (item.isActive = false));
          }
          this.PD_LIST = PD;
          this.ZL_LIST = ZL;
        }
      });
    },
    // 搜索
    search() {
      this.loadData();
    },
    // action 点击添加
    add() {
      this.checkBoxInit();
      this.modal_visable = true;
    },
    checkBoxInit() {
      //遍历评定列表设置取消
      this.PD_LIST.forEach(v => {
        v.isActive = false;
      });

      //遍历治疗列表设置取消
      this.ZL_LIST.forEach(v => {
        v.LBXMS.forEach(vv => {
          vv.isActive = false;
        });
      });
    },
    //点击编辑按钮获取用户信息
    edit(id) {
      this.checkBoxInit();
      this.ajax(
        "/api/Patient/GetPatientAndPdandZLInfo",
        "get",
        { id },
        true
      ).then(res => {
        let response = res.data;
        if (response.code == 200) {
          let HZXI = response.data.HZXI && response.data.HZXI[0];
          let PD = response.data.PD;
          let ZL = response.data.ZL;
          //遍历评定列表设置选中
          this.PD_LIST.forEach(v => {
            PD.forEach(vv => {
              if (v.ID == vv.project_id) {
                v.isActive = true;
              }
            });
          });

          //遍历治疗列表设置选中
          this.ZL_LIST.forEach(v => {
            v.LBXMS.forEach(vv => {
              ZL.forEach(vvv => {
                if (vv.id == vvv.project_id) {
                  vv.isActive = true;
                  vv.PC = vvv.project_rate;
                  vv.BW = vvv.project_position;
                  vv.BZ = vvv.project_Remark;
                }
              });
            });
          });

          this.suffers_form = HZXI;
          this.suffers_form.YS = window.localStorage.Nickname;
          this.modal_visable = true;
        }
      });
    },
    //获取排班详情
    set_turn(id) {
      this.HZ_ID = id;
      this.modal2_visable = true;
      this.ajax(
        "/api/Patient/GetPatientAndScheduling/",
        "get",
        { id },
        true
      ).then(res => {
        let response = res.data;
        if (response.code == 200) {
          //格式化数据绑定到表单组件
          response.data.tabledata.forEach((v, index) => { 
            if (v.Job) v.Job = parseInt(v.Job);
            this.projectChange(v.Job, index);
            v.TIME = [];
            v.ZLSs = [];
            if (v.Time) {
              v.TIME[0] = v.Time.split("-")[0];
              v.TIME[1] = v.Time.split("-")[1];
            }
          });

          this.PB_FORM = response.data.tabledata;

          this.MY_ZLXM = response.data.ZLXM;
        }
      });
    },
    // action 点击删除
    remove(id) {
    },
    // 弹层点击确定回调
    modal_ok() {
      //处理表单信息

      this.$refs["suffers_form"].validate(valid => {
        if (!valid) {
          this.$Message.error("提交信息有误!");
          return;
        }

        let suffers_form = this.suffers_form;
        let suffers_data = {
          Id: suffers_form.Id,
          Nickname: suffers_form.Nickname,
          Sex: suffers_form.Sex,
          Age: suffers_form.Age,
          Bed: suffers_form.Bed,
          Checkin: suffers_form.Checkin,
          Attack_time: suffers_form.Attack_time,
          Checkin_time: suffers_form.Checkin_time,
          Member_id: window.localStorage.UserId,
          Diagnose: suffers_form.Diagnose,
          Status: suffers_form.Status,
          Notes: suffers_form.Notes,
          History: suffers_form.History,
          Infect: suffers_form.Infect,
          Judge: "", //?????
          Treat: "", //?????
          Created_time: "", //?????
          Update_time: "", //?????
          Bedh: suffers_form.Bedh,
          Drip: suffers_form.Drip,
          Type: suffers_form.Type
          // PD_list: [],
          // ZL_list: []
        };
        //评定项目列表
        let l1 = [];
        this.PD_LIST.forEach(v => {
          if (v.isActive) {
            l1.push({
              project_id: v.ID,
              project_name: v.NAME,
              Category_id: v.Category_id
            });
          }
        });

        // "ZL_list": [{
        //   "project_id": "1",
        //   "project_name": "颈椎",
        //   "Category_id": "4",
        //   "project_rate": "1",
        //   "project_position": "2",
        //   "project_Remark": "2"
        // }]

        let l2 = []; //已勾选的治疗项目列表
        this.ZL_LIST.map(v => {
          v.LBXMS.map(vv => {
            if (vv.isActive) {
              l2.push({
                project_id: vv.id,
                project_name: vv.XMMC,
                Category_id: vv.XMLB,
                project_rate: vv.PC || "",
                project_position: vv.BW || "",
                project_Remark: vv.BZ || ""
              });
            }
          });
        });
        var formData = {
          HZXI: suffers_data,
          PD_list: l1,
          ZL_list: l2
        };

        // return;
        console.log(JSON.stringify(formData));
        
        //提交
        this.ajax(
          "/api/Patient/AddPatientAndCure",
          "post",
          formData,
          true
        ).then(res => {
          let response = res.data;
          if (response.code == 200) {
            this.modal_visable = true;
            this.$Notice.success({
              title: "操作提示",
              desc: response.msg
            });
          }
        });
      });
    },
    // 弹层点击取消回调
    modal_cancel() {
      this.modal_visable = false;
    },
    // 弹层显示状态转变后清空表单
    reset_modal_form() {
      this.$refs["suffers_form"].resetFields();
    },
    modal2_close() {
      // 初始化排班表单
      this.ZLS_ZLXM = []; //患者排班-当前患者的排班列表
      this.MY_ZLXM = []; //患者排班-我的治疗项目
      this.PB_FORM = [];
    },
    modal2_cancel() {
      this.modal2_visable = false;
    },
    modal2_ok() {
      let PB_FORM = this.PB_FORM;

      let formData = [];

      let invalid = false;
      PB_FORM.forEach(v => {
        if (!v.TIME || !v.TIME[0] || !v.TIME[1]) {
          invalid = true;
          this.$Message.error("请选择时间!");
        }
        if (!v.Job) {
          invalid = true;
          this.$Message.error("请选择治疗项目!");
        }
        if (!v.Member_id) {
          invalid = true;
          this.$Message.error("请选择负责人!");
        }
        if (!v.Address) {
          invalid = true;
          this.$Message.error("请输入地点!");
        }
        formData.push({
          Time: v.TIME.join("-"), //开始时间和结束时间拼接
          Job: v.Job, // 治疗项目id
          Member_id: v.Member_id, // 负责人id
          Address: v.Address // 地点
        });
      });
      if (invalid) {
        return;
      }

      this.ajax(
        "/api/Patient/UpdatePatientScheduling",
        "post",
        {
          id: this.HZ_ID,
          PB_list: formData
        },
        true
      ).then(res => {
        let response = res.data;
        if (response.code == 200) {
          // this.modal2_visable = false;
          // this.$Message.success("更新成功");
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../style/base.css";
.add-button {
  margin: 0 0 5px 0;
}

.action-button {
  margin-right: 2px;
}

.info-table,
.table-turn {
  width: 100%;
  tr {
    text-align: center;
    td.title {
      background: #f7f7f7;
      text-align: right;
    }
    th.title {
      background: #f7f7f7;
    }
    td.notnull:before {
      content: "*";
      display: inline-block;
      margin-right: 4px;
      line-height: 1;
      font-family: SimSun;
      font-size: 12px;
      color: #ed4014;
    }
    td {
      border: 1px solid #e8eaec;
      margin: 0;
      min-width: 80px;
      padding: 0;
      .ivu-form-item {
        margin-bottom: 0;
      }
    }
    th {
      border: 1px solid #e8eaec;
      padding: 4px 0;
    }
    .ivu-icon {
      margin-top: 0px;
    }
  }
}
.table-turn {
  td {
    height: 38px;
  }
}
.ivu-card {
  margin-top: 5px;
}
.label-input {
  margin-left: 80px;
}
.item-title {
  margin-left: 16px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 550;
}
.left-divider {
  border-left: 1px solid #e8eaec;
  padding: 5px;
}
</style>
<style>
.info-table .ivu-form-item .ivu-input,
.info-table .ivu-form-item .ivu-select-selection,
.table-turn .ivu-form-item .ivu-input,
.table-turn .ivu-form-item .ivu-select-selection {
  border: 1px solid transparent;
  border-radius: 0;
  width: 100%;
}
.info-table .ivu-form-item-error .ivu-input,
.info-table .ivu-form-item-error .ivu-select-selection,
.table-turn .ivu-form-item-error .ivu-input,
.table-turn .ivu-form-item-error .ivu-select-selection {
  border: 1px solid #ed4014;
}
.suffer_form .ivu-card-head {
  padding: 5px 10px;
}
</style>

